package ch06;

import java.util.Scanner;

public class BankTester {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Bank firstBankOfJava = new Bank();
		firstBankOfJava.addAccount(new BankAccount(1001, 20000));
		firstBankOfJava.addAccount(new BankAccount(1015, 10000));
		firstBankOfJava.addAccount(new BankAccount(1729, 15000));
		
		Scanner in = new Scanner(System.in);
		
		System.out.println("Input threshold for testin countBalanceAtLeast:");
		double threshold = in.nextDouble();
		int c = firstBankOfJava.countBalancesAtLeast(threshold);
		System.out.println("Count: " + c);
		System.out.println("Input expected count:");
		int expectedCount = in.nextInt();
		System.out.println("Expected: " + expectedCount);
		
		System.out.println("Input account number for testing find");
		int accountNumber = in.nextInt();
		BankAccount a = firstBankOfJava.fint(accountNumber);
		if (a == null) 
		{
			System.out.println("No matching account");
		} else {
			System.out.println("Balance of maching account: " + a.getBalance());
			System.out.println("Input expected balance");
			int machingBalance = in.nextInt();
			System.out.println("Expected: " + machingBalance);
		}
		
		BankAccount max = firstBankOfJava.getMaximum();
		System.out.println("Account with largest balance: " + max.getAccountNumber());
		System.out.println("Expected: 1001");

	}

}
